// 实时显示当前时间
$(document).ready(function () {
    function PrefixInteger(num, length) {
        return (Array(length).join('0') + num).slice(-length);
    }
    function showTime() {
        var today = new Date;
        var y = today.getFullYear();
        var M = today.getMonth() + 1;
        var d = today.getDate();
        var w = today.getDay();
        var h = PrefixInteger(today.getHours(),2);
        var m = PrefixInteger(today.getMinutes(),2);
        var s = PrefixInteger(today.getSeconds(),2);
        var week = ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
        $("#time").html(y + '年' + M + '月' + d + '日  ' + '&nbsp;' + h + ':' + m + ':' + s + ' &nbsp;' + week[w]);
    }
    showTime();                     //先调用下，否则还需一秒后才呈现
    setInterval(showTime, 1000);    //每1秒(1000毫秒)后调用 showTime()
})